<template>
   
    <component :menuList="List" :checkout="checkout" :is="isWeb?Web:Desk" />
</template>
<script setup lang='ts'>
import {get} from "../utils/session"
import Web from "./components/Web.vue"
import Desk from "./components/Desk.vue"
import {ref,onMounted} from "vue"
import {queryAuth} from "../api/system"
import {createTree} from "../utils/func"
const List=ref<TreeItem[]>([])
// const isWeb=get("port")
const getData=async ()=>{
       let res:ResData= await queryAuth() as ResData
       let data:ListItem[]=res.data as ListItem[]
       List.value= createTree(data)
}
const isWeb=ref<boolean>(false)
const checkout=()=>{
    // console.log('layout');
    isWeb.value=!!get("port")
    
}
// let isWeb=ref<boolean>(false)
onMounted(()=>{
    
    checkout()
    getData()
})
</script>
<style scoped >
</style>
